import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/Home.vue'
import Tab from '../views/Tab/Tab.vue'
import Center from '../views/Center/Center.vue'
import Login from '../views/Login/Login.vue'
// import Cart from '../views/Cart/Cart.vue'
import Society from '../views/Society/Society.vue'
import SocietyVideo from '../views/Society/SocietyVideo.vue'
import SocietyArticle from '../views/Society/SocietyArticle.vue'
import Classification from '../views/Society/Classification.vue'
import Sort from '../views/Society/Sort.vue'
import SocietyRelease from '../views/Society/SocietyRelease'
import Category from '../views/Category/category'
import AllGoods from '../views/AllGoods/AllGoods'
import ProductDetail from '../views/ProductDetail/ProductDetail'
import shopOrder from '@/views/ShopOrder/ShopOrder.vue'
import orderPL from '@/views/ShopOrder/orderPL.vue'
import orderTK from '@/views/ShopOrder/orderTK.vue'
import orderWL from '@/views/ShopOrder/orderWL.vue'
import shopCollcet from '@/views/shopCollcet/shopCollcet.vue'
import myFootPrint from '@/views/myFootPrint/myFootPrint.vue'
import myAddress from '@/views/myAddress/myAddress.vue'
import addAddress from '@/views/myAddress/addAddress.vue'
import ShopList from '@/views/ShopList/ShopList'
import ShopHome from '@/views/ShopHome/ShopHome'
import ShopDetail from '@/views/ShopHome/ShopDetail'
import ShopLike from '@/views/ShopLike/ShopLike'
import ApplyJoin from '@/views/ApplyJoin/ApplyJoin'
import CreateOrder from '@/views/CreateOrder/CreateOrder'
import shareCenter from '@/views/shareCenter/shareCenter'
import CashRecord from '@/views/CashRecord/CashRecord'
import Commission from '@/views/Commission/Commission'
import Poster from '@/views/Poster/Poster'
import PromoterList from '@/views/PromoterList/PromoterList'
import PromoterOrder from '@/views/PromoterOrder/PromoterOrder'
import UserCash from '@/views/UserCash/UserCash'
import Clause from '@/views/Clause/Clause'
import Setting from '@/views/Setting/Setting'
import Account from '@/views/Setting/Account'
import PayPWD from '@/views/Setting/PayPWD'
import LoginPWD from '@/views/Setting/LoginPWD'
import IMPage from '@/views/IMPage/IMPage'
import chatPage from '@/views/IMPage/chatPage'
import BusinessCenter from '@/views/BusinessCenter/BusinessCenter'
import StoreAuthInfo from '@/views/StoreAuthInfo/StoreAuthInfo'
import Download from '@/views/Download/Download'
import ShopManage from '@/views/ShopManage/ShopManage'
import City from '@/views/City/City'
import Bargain from '@/views/Bargain/Bargain'
import myOrder from '@/views/myOrderList/myOrderList'
import Advert from '@/views/AdvPage/AdvPage'
import DataStatis from '@/views/DataStatis/DataStatis'
import ServerUser from '@/views/ServerUser/ServerUser'
import ChildAccount from '@/views/ChildAccount/ChildAccount'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'tab',
    component: Tab,
    children: [{
      path: '',
      redirect: 'index',
      component: Home
    }, {
      path: '/index',
      name: 'index',
      component: Home
    }, {
      path: '/center',
      name: 'center',
      component: Center,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      }
    }, {
      path: '/impage',
      name: 'impage',
      component: IMPage,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      }
    },
    // {
    //   path: '/cart',
    //   name: 'cart',
    //   component: Cart,
    //   meta: {
    //     requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    //   }
    // },
    {
      path: '/society',
      name: 'society',
      component: Society
    }]
  }, {
    path: '/login',
    name: 'login',
    component: Login
  }, {
    path: '/classification',
    name: 'classification',
    component: Classification,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/sort',
    name: 'sort',
    component: Sort,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/join',
    name: 'join',
    component: ApplyJoin,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/societyrelease',
    name: 'societyrelease',
    component: SocietyRelease,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/SocietyArticle/:id',
    name: 'SocietyArticle',
    component: SocietyArticle
  }, {
    path: '/SocietyVideo/:id',
    name: 'SocietyVideo',
    component: SocietyVideo
  }, {
    path: '/category',
    name: 'category',
    component: Category
  }, {
    path: '/allgoods',
    name: 'allgoods',
    component: AllGoods
  }, {
    path: '/productDetail/:id',
    name: 'productDetail',
    component: ProductDetail
  }, {
    path: '/shopOrder',
    name: 'shopOrder',
    component: shopOrder,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/shopCollcet',
    name: 'shopCollcet',
    component: shopCollcet,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/myFootPrint',
    name: 'myFootPrint',
    component: myFootPrint,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/myAddress',
    name: 'myAddress',
    component: myAddress,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/addAddress',
    name: 'addAddress',
    component: addAddress,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/shophome/:id',
    name: 'shophome',
    component: ShopHome
  }, {
    path: '/shopdetail/:id',
    name: 'shopdetail',
    component: ShopDetail
  }, {
    path: '/shoplist',
    name: 'shoplist',
    component: ShopList
  }, {
    path: '/shoplike',
    name: 'shoplike',
    component: ShopLike,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/CreateOrder',
    name: 'CreateOrder',
    component: CreateOrder,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/shareCenter',
    name: 'shareCenter',
    component: shareCenter,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/user/cashrecord',
    name: 'cashRecord',
    component: CashRecord,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/user/commission',
    name: 'commission',
    component: Commission,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/user/promoter_list',
    name: 'promoter-list',
    component: PromoterList,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/user/poster',
    name: 'poster',
    component: Poster,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/user/promoter_order',
    name: 'promoter-order',
    component: PromoterOrder,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/user/user_cash',
    name: 'user_cash',
    component: UserCash,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/clause',
    name: 'clause',
    component: Clause
  }, {
    path: '/setting',
    name: 'setting',
    component: Setting,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/account',
    name: 'account',
    component: Account
  }, {
    path: '/business',
    name: 'business-center',
    component: BusinessCenter,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/paypwd',
    name: 'paypwd',
    component: PayPWD,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/loginpwd',
    name: 'loginpwd',
    component: LoginPWD,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/chatpage',
    name: 'chatpage',
    component: chatPage
  }, {
    path: '/storeDetail',
    name: 'storeDetail',
    component: StoreAuthInfo,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/download',
    name: 'download',
    component: Download
  }, {
    path: '/shopManage',
    name: 'shopManage',
    component: ShopManage,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/city',
    name: 'city',
    component: City
  }, {
    path: '/advert',
    name: 'advert',
    component: Advert
  }, {
    path: '/orderpl/:unique',
    name: 'orderpl',
    component: orderPL,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/ordertk/:oid',
    name: 'ordertk',
    component: orderTK,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/orderwl/:oid',
    name: 'orderwl',
    component: orderWL,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/bargain/:id?',
    name: 'bargain',
    component: Bargain,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, {
    path: '/myOrder',
    name: 'my-order',
    component: myOrder,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, { // 数据统计
    path: '/dataStatis',
    name: 'dataStatis',
    component: DataStatis,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, { // 数据统计
    path: '/serverUser',
    name: 'serverUser',
    component: ServerUser,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }, { // 子账户管理
    path: '/ChildAccount',
    name: 'ChildAccount',
    component: ChildAccount,
    meta: {
      requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
